package SSM.Chat.Service.impl;


import SSM.Chat.Dao.BookDao;
import SSM.Chat.Domain.*;
import SSM.Chat.Service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("BookServiceImpl")
// 将数据层变成bean
public class BookServiceImpl implements BookService {
    @Autowired
    // 自动装配其他bean
    private BookDao bookDao;


    @Override
    public List<Settings> SettingSelectAll() {
        List<Settings> settings = bookDao.SettingSelectAll();
        return settings;
    }

    @Override
    public void AutoCodeAdd(AuthCode authCode) {
        bookDao.AutoCodeAdd(authCode);
    }

    @Override
    public List<AuthCode> AutoCodeSelectAll() {
        List<AuthCode> AuthCode = bookDao.AutoCodeSelectAll();
        return AuthCode;
    }

    @Override
    public void DelAutoCode(AuthCode authCode) {
        bookDao.DelAutoCode(authCode);
    }

    @Override
    public AuthCode SelectTypeAutoCode(AuthCode authCode) {
        AuthCode authCode1 = bookDao.SelectTypeAutoCode(authCode);
        return authCode1;
    }

    @Override
    public User SelectUserMailbox(String userMailbox) {
        User user = bookDao.SelectUserMailbox(userMailbox);
        return user;
    }

    @Override
    @Transactional(value = "To")
    public void UserAdd(User user) {
        bookDao.UserAdd(user);
    }

    @Override
    @Transactional(value = "To")
    public void SettingAdd(Settings settings) {
        bookDao.SettingAdd(settings);
    }

    @Override
    @Transactional(value = "To")
    public Boolean AutoCodeUpdateUse(AuthCode authCode) {
        bookDao.AutoCodeUpdateUse(authCode);
        return true;
    }


    @Override
    public User UserLogin(User user) {
        User user1 = bookDao.UserLogin(user);
        return user1;
    }

    /**
     * 根据邮箱修改密码
     *
     * @param user
     */
    @Override
    @Transactional(value = "To")
    public void UserUpdatePassword(User user) {
        bookDao.UserUpdatePassword(user);
    }

    @Override
    @Transactional(value = "To")
    public User UserSelectMailbox(String userMailbox) {
        User user = bookDao.UserSelectMailbox(userMailbox);
        return user;
    }

    @Override
    public Settings SettingSelectMailbox(String userMailbox) {
        Settings settings = bookDao.SettingSelectMailbox(userMailbox);
        return settings;
    }

    @Override
    public List<Buddy> BuddySelectOneself(String buddyOneselfId) {
        List<Buddy> buddies = bookDao.BuddySelectOneself(buddyOneselfId);
        return buddies;
    }

    @Override
    public List<User> UserBatchSelect(String[] list) {
        List<User> buddies = bookDao.UserBatchSelect(list);
        return buddies;
    }

    @Override
    public List<Group> GroupSelectUserId(String groupUserId) {
        List<Group> buddies = bookDao.GroupSelectUserId(groupUserId);
        return buddies;
    }

    @Override
    public List<User> UserNotBatchSelect(String[] list, String userMailbox) {
        List<User> buddies = bookDao.UserNotBatchSelect(list, userMailbox);
        return buddies;
    }

    @Override
    public List<User> UserBlurSelect(User user) {
        List<User> buddies = bookDao.UserBlurSelect(user);
        return buddies;
    }

    @Override
    public Group GroupSelectName(Group group) {
        Group group1 = bookDao.GroupSelectName(group);
        return group1;
    }

    @Override
    @Transactional(value = "To")
    public void GroupInformation(Group group) {
        bookDao.GroupInformation(group);
    }

    @Override
    public void BuddyInformation(Buddy buddy) {
        bookDao.BuddyInformation(buddy);
    }

    @Override
    public void AwaitInformation(Await await) {
        bookDao.AwaitInformation(await);
    }

    @Override
    public List<Await> AwaitSelectPrimary(String awaitPrimary) {
        List<Await> awaits = bookDao.AwaitSelectPrimary(awaitPrimary);
        return awaits;
    }

    @Override
    public List<Await> AwaitSelectPrimaryType(String awaitPrimary, String awaitType) {
        List<Await> awaits =
                bookDao.AwaitSelectPrimaryType(awaitPrimary, awaitType);
        return awaits;
    }

    @Override
    public void AwaitUpdateState(Await await) {
        bookDao.AwaitUpdateState(await);
    }

    @Override
    public Group GroupSelectId(Group group) {
        Group group1 = bookDao.GroupSelectId(group);
        return group1;
    }

    @Override
    public Await AwaitSelectMailbox(Await await) {
        Await await1 = bookDao.AwaitSelectMailbox(await);
        return await1;
    }

    @Override
    public void AwaitDelete(Await await) {
        bookDao.AwaitDelete(await);
    }

    @Override
    public void GroupUpdateName(Group group) {
        bookDao.GroupUpdateName(group);
    }

    @Override
    public void GroupDelete(Group group) {
        bookDao.GroupDelete(group);

    }

    @Override
    public void BuddyUpdateGroup(Buddy buddy) {
        bookDao.BuddyUpdateGroup(buddy);
    }

    @Override
    public Buddy BuddySelectInformation(Buddy buddy) {
        Buddy buddy1 = bookDao.BuddySelectInformation(buddy);
        return buddy1;
    }

    @Override
    public void BuddyDelete(Buddy buddy) {
        bookDao.BuddyDelete(buddy);
    }

    @Override
    public List<Buddy> BuddySelectMailboxId(Buddy buddy) {
        List<Buddy>  buddy1 = bookDao.BuddySelectMailboxId(buddy);
        return buddy1;
    }

    @Override
    public List<Await> AwaitSelectAll() {
        List<Await>  await1 = bookDao.AwaitSelectAll();
        return await1;
    }

    @Override
    public ChatList ChatListSelectMailbox(ChatList chatList) {
        ChatList  chatList1 = bookDao.ChatListSelectMailbox(chatList);
        return chatList1;
    }

    @Override
    public void ChatListInformation(ChatList chatList) {
        bookDao.ChatListInformation(chatList);
    }

    @Override
    public void ChatListUpdateType(ChatList chatList) {
        bookDao.ChatListUpdateType(chatList);
    }

    @Override
    public void ChatInformation(Chat chat) {
        bookDao.ChatInformation(chat);

    }

    @Override
    public List<Chat> ChatSelectMailbox(Chat chat) {

        List<Chat> chats = bookDao.ChatSelectMailbox(chat);
        return chats;
    }

    @Override
    public List<Settings> test() {
             List<Settings> chats = bookDao.test();
        return chats;
    }

    @Override
    public void ImageInformation(Image image) {
        bookDao.ImageInformation(image);
    }

    @Override
    public Image ImageSelectId(String image) {
        Image image1 = bookDao.ImageSelectId(image);
        return image1;
    }

    @Override
    public void ChatUpdateMailboxType(Chat chat) {
        bookDao.ChatUpdateMailboxType(chat);
    }

    @Override
    public Chat ChatSelectId(Integer chatId) {
        Chat chat = bookDao.ChatSelectId(chatId);
        return chat;
    }

    @Override
    public void ChatDelete(Integer chatId) {
        bookDao.ChatDelete(chatId);

    }

    @Override
    public void ImageDelete(String imageId) {
        bookDao.ImageDelete(imageId);
    }

    @Override
    public List<Chat> ChatSelectMailBoxType(Chat chat) {
        List<Chat> chats = bookDao.ChatSelectMailBoxType(chat);
        return chats;
    }

    @Override
    public List<ChatList> ChatListSelectMailboxAll(String chatListMailbox) {
        List<ChatList> chats = bookDao.ChatListSelectMailboxAll(chatListMailbox);
        return chats;
    }

    @Override
    public void ChatListUpdateNew(ChatList chatList) {
        bookDao.ChatListUpdateNew(chatList);
    }

    @Override
    public void ChatListText(ChatList chatList) {
        bookDao.ChatListText(chatList);
    }

    @Override
    public void SettingUpdateTheme(Settings settings) {
        bookDao.SettingUpdateTheme(settings);
    }

    @Override
    public void SettingUpdateSidebar(Settings settings) {
        bookDao.SettingUpdateSidebar(settings);
    }
}


